import Vue from 'vue'
import Router from 'vue-router'
const choose = () => import('@/views/user/choose')
const userinfo = () => import('@/views/user/personal/index')
const feedback = () => import('@/views/user/feedback/index')
const orderLoading = () => import('@/views/user/order/index')
const registerOpen = () => import('@/views/user/registerOper')
const initiateing = () => import('@/views/user/initiateing')
const binding = () => import('@/views/agent/personal/binding')
const cash = () => import('@/views/agent/personal/cash')
const feedbackForOper = () => import('@/views/agent/personal/feedback')
const price = () => import('@/views/agent/personal/price')
const device = () => import('@/views/agent/device/index')
const deviceOrder = () => import('@/views/agent/device/deviceOrder')
const operating = () => import('@/views/agent/operating/index')
const selectProgram = () => import('@/views/agent/selectProgram/index')
const getCoords = () => import('@/views/agent/personal/get_coords')

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/userinfo'
    },
    {
      path: '/choose/:params',
      name: 'choose',
      component: choose
    },
    {
      path: '/userinfo/:openId',
      name: 'userinfo',
      component: userinfo
    },
    {
      path: '/registerOpen',
      name: 'registerOpen',
      component: registerOpen
    },
    {
      path: '/orderLoading/:openId',
      name: 'orderLoading',
      component: orderLoading
    },
    {
      path: '/binding/:openId/:factory/:type/:deviceSN/:moduleSN/',   // 0. openId 1. 厂家 2. 类型 3. 设备sn, 4.模组sn
      name: 'binding',
      component: binding
    },
    {
      path: '/cash/:type',
      name: 'cash',
      component: cash
    },
    {
      path: '/feedbackForOper',
      name: 'feedbackForOper',
      component: feedbackForOper
    },
    {
      path: '/price',
      name: 'price',
      component: price
    },
    {
      path: '/feedback', // :deviceId/:deviceTypeName/:agencyId  设备ID, 设备名称，运营商ID
      name: 'feedback',
      component: feedback
    },
    {
      path: '/operating',
      name: 'operating',
      component: operating
    },
    {
      path: '/device',
      name: 'device',
      component: device
    },
    {
      path: '/selectProgram', // :openId/:deviceType/:deviceStatus/:role/:sn/:type
      name: 'selectProgram',
      component: selectProgram
    },
    {
      path: '/deviceOrder',
      name: 'deviceOrder',
      component: deviceOrder
    },
    {
      path: '/initiateing',
      name: 'initiateing',
      component: initiateing
    },
    { // 手动定位
      path: '/getCoords',
      name: 'getCoords',
      component: getCoords
    }
  ]
})
